
//########################################################
// JavaScripts for Master Header and Nav Bar
// Jay Kim, 10/5/2007
//########################################################

var masterNavTimerID = null;
var masterNavTimerOn = false;
var masterNavTimeCount = 200;

function showHideMasterSubNav(navId, subNavId, flag, iframeHeight) {
	var navItemElmTr = document.getElementById(navId + "_tr");
	if (navItemElmTr) {
		navItemElmTr.style.color = (flag) ? '#FFFFFF' : '#FFFFFF';
		if (flag == true) {
			navItemElmTr.style.backgroundImage = "none";
			navItemElmTr.style.backgroundColor = '#7E7E7E';
						
		}
		else {
			navItemElmTr.style.backgroundImage = "none";
			navItemElmTr.style.backgroundColor = '';
		}
	}

	var subNav = document.getElementById(subNavId);
	if (subNav) {
		isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
		subNav.style.display = (flag) ? 'block' : 'none';
		if (flag) {				
			if (isIE6) {
				zxcAddIFrame(subNav, iframeHeight, 294);
			}
		} else {			
			if (isIE6) {
				zxcRemoveIFrame(subNav);
			}		
		}
	}
}

function zxcAddIFrame(zxcid, iframeHeight, iframeWidth){
 if (!document.all){ return; }
 var backgroundColor = '#C3C3C3';
 var zxcobj=zxcid;
 if  (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcid); }
 //if (!zxcobj.ifr){
  zxcES(zxcobj,{zIndex:(zxcGetStyle(zxcobj,'z-index')||zxcGetStyle(zxcobj,'zIndex')||'2')});
  zxcobj.ifr=zxcES('IFRAME',{position:'absolute',overflow:'hidden',zIndex:(parseInt(zxcGetStyle(zxcobj,'zIndex'))-1),visibility:'visible'});
  // To prevent message of mixed ssl and not ssl content.
  zxcobj.ifr.src="javascript:false";
  zxcobj.ifr.scrolling="no";
  zxcobj.ifr.frameBorder="0";
  zxcobj.parentNode.appendChild(zxcobj.ifr);
 //}
 zxcES(zxcobj.ifr,{visibility:zxcGetStyle(zxcobj,'visibility')||'hidden',left:zxcobj.offsetLeft+'px',top:zxcobj.offsetTop+'px', width:iframeWidth,height:iframeHeight});
 //zxcobj.ifr.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
}

function zxcRemoveIFrame(zxcid){
 if (!document.all){ return; }
 var zxcobj=zxcid;
 if  (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcid); }
 if (zxcobj.ifr){
 	var iframeNode = zxcobj.ifr;
 	if (iframeNode.parentNode != null) {
 		iframeNode.parentNode.removeChild(iframeNode);
 		//alert("Removed iframeNode");
 	} 	 
 }
 
}

function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
 if (zxcp){ zxcp.appendChild(zxcele); }
 if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
 return zxcele;
}

function zxcGetStyle(zxcel,zxcs){
 if (zxcel.style[zxcs]){ return zxcel.style[zxcs]; }
 if (zxcel.currentStyle){ return zxcel.currentStyle[zxcs]; }
 if (window.getComputedStyle){ return document.defaultView.getComputedStyle(zxcel,null).getPropertyValue(zxcs); }
 return false;
}


function startMasterNavTimer() {
	if (masterNavTimerOn == false) {
		masterNavTimerID=setTimeout("hideAllMasterSubNavs()",masterNavTimeCount);
		masterNavTimerOn = true;
	}
}

function stopMasterNavTimer() {
	if (masterNavTimerOn) {
		clearTimeout(masterNavTimerID);
		masterNavTimerID = null;
		masterNavTimerOn = false;
	}
}


